//
//  ModifyTextField.m
//  itboye_jsq_ios
//
//  Created by mc on 15/12/16.
//  Copyright © 2015年 itboye. All rights reserved.
//

#import "ModifyTextField.h"

@implementation ModifyTextField 


// 自定义初始化方法
- (instancetype)initWithFrame:(CGRect)frame placeholder:(NSString *)placeholder
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        // 设置圆角
        self.layer.cornerRadius = 5;
        // 设置边框
        self.layer.borderWidth = 0.5;
        self.layer.borderColor = [UIColor lightGrayColor].CGColor;
        // 设置代理
        //self.delegate = self;
        // 提示文字
        NSDictionary *attrDic = @{NSFontAttributeName:[UIFont systemFontOfSize:15]};
        NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:placeholder attributes:attrDic];
        self.attributedPlaceholder = attrString;
        
    }
    return self;
}

//控制 placeHolder 的位置，左右缩 20
- (CGRect)textRectForBounds:(CGRect)bounds {
    return CGRectInset( bounds , 10 , 0 );
}

// 控制文本的位置，左右缩 20
- (CGRect)editingRectForBounds:(CGRect)bounds {
    return CGRectInset( bounds , 10 , 0 );
}


//#pragma mark - UITextField代理方法
//// 开始编辑
//- (void)textFieldDidBeginEditing:(UITextField *)textField
//{
//    // 设置边框
//    self.layer.borderWidth = 1;
//    //self.layer.borderColor = JSQ_MORELIGHT_COLOR.CGColor;
//}
//
//
//// 结束编辑
//- (void)textFieldDidEndEditing:(UITextField *)textField
//{
//    // 设置边框
//    self.layer.borderWidth = 1;
//    self.layer.borderColor = [UIColor lightGrayColor].CGColor;
//}
//



@end
